package cn.wd.qo;

import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Getter;
import lombok.Setter;
import org.springframework.format.annotation.DateTimeFormat;

import java.util.Date;

@Getter
@Setter
public class VideoQuery extends QueryObject {

    private String keyword;

    private Integer status = -1;
    private Integer deleted = 0;
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date beginDate;
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date endDate;

    public void setDeleted(Integer deleted) {
        // 如果没有设置 deleted，默认查询未被删除的
        this.deleted = deleted == null ? 0 : deleted;
    }
}